package org.xm.moretriggercommands;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitTask;
import org.xm.moretriggercommands.Event.*;

public class EventRegistrar implements Listener {

    private BukkitTask tpsTask;

    private TPSUtil tpsUtil;

    @EventHandler
    public PluginManager pluginManager() {
        PluginManager pluginManager = Main.getInstance().getServer().getPluginManager();

        tpsUtil = new TPSUtil(Main.getInstance()); // 初始化成员变量

        Main.getInstance().getServer().getPluginManager().registerEvents(new KillNotifierPlugin(), Main.getInstance());

        Main.getInstance().getServer().getPluginManager().registerEvents(new CustomizeCommand(), Main.getInstance());

        Main.getInstance().getServer().getPluginManager().registerEvents(new LifeLessThan(), Main.getInstance());

        pluginManager.registerEvents(new InventoryClose(), Main.getInstance());

        pluginManager.registerEvents(new InventoryOpen(), Main.getInstance());

        pluginManager.registerEvents(new Join(), Main.getInstance());

        pluginManager.registerEvents(new PlayerDeath(), Main.getInstance());

        pluginManager.registerEvents(new PlayerRespawn(), Main.getInstance());

        pluginManager.registerEvents(new ResourcePackStatus(), Main.getInstance());

        pluginManager.registerEvents(new PlayerBedEnter(), Main.getInstance());

        pluginManager.registerEvents(new PlayerBedLeave(), Main.getInstance());

        pluginManager.registerEvents(new PlayerDropItem(), Main.getInstance());

        pluginManager.registerEvents(new PlayerChangedWorld(), Main.getInstance());

        pluginManager.registerEvents(new RegionListener(), Main.getInstance());
        return pluginManager;
    }
}
